package com.lv.service.bean

import android.os.Parcelable
import androidx.annotation.Keep
import com.jeremyliao.liveeventbus.core.LiveEvent
import kotlinx.parcelize.Parcelize

/**
 * 作者： ygx
 * 创建日期：2022/8/11 11:03 PM
 * 签名： 天行健，君子以自强不息；地势坤，君子以厚德载物。
 * -    _              _           _     _   ____  _             _ _
 * -   / \   _ __   __| |_ __ ___ (_) __| | / ___|| |_ _   _  __| (_) ___
 * -  / _ \ | '_ \ / _` | '__/ _ \| |/ _` | \___ \| __| | | |/ _` | |/ _ \
 * - / ___ \| | | | (_| | | | (_) | | (_| |  ___) | |_| |_| | (_| | | (_) |
 * -/_/   \_\_| |_|\__,_|_|  \___/|_|\__,_| |____/ \__|\__,_|\__,_|_|\___/
 *
 * You never know what you can do until you try !
 * ----------------------------------------------------------------
 *
 */
@Keep
data class GoodsBean(
    var counts: Int,
    val page: String,
    val pagesize: String,
    val pages: String,
    val items: List<GoodsItemBean>?,
)

@Parcelize
@Keep
data class GoodsItemBean(
    var id: String,
    val name: String,
    var salenum: Int,
    var ismarketable: String,//0 下架 1 上架
    var isaudit: String,//0 风险下架（风险下架） 1 待审 不可编辑（风险下架）   2 审核通过上架（上架、下架）
    val image: String,
    val cpname: String?,
    val created: Long,
    val price: String,
    var reseq: Long,//不为0：推荐
    val seq: String,
    val issale: String,
    val fcname: String,
    var backdrop: String?,
    var isSelected: Boolean = false,

//    val thumbupList: List<String>,
//    val collectionList: List<String>,
) : LiveEvent, Parcelable

fun GoodsItemBean.getAtTab(): Int {
    var toFlag = 0
    if (this.ismarketable == "0") {
        when (this.isaudit) {
            "0", "1" -> {//风险下架
                toFlag = 2
            }

            "2" -> {//下架
                toFlag = 1
            }
        }
    }
    return toFlag
}

@Keep
data class GoodsParamsBean(
    var counts: Int,
    val page: Int,
    val pagesize: Int,
    val pages: Int,
    val attached: String,
    val items: List<String>?,
)

@Parcelize
@Keep
data class GoodsDetailsBean(
    val address: String,
    val area: String,
    val attentionnum: Int,
    val attribute: String,
    val backdrop: String,
    val batch: Int,
    val bname: String,
    val city: String,
    val collectionnum: Int,
    val companytel: String,
    val cplogo: String,
    val cpname: String,
    val cpyid: String,
    val created: Long,
    val describes: List<ImageTypeBean>?,
    val display: String,
    val fcaid: Int,
    val fcname: String,
    val id: String,
    val image: String,
    val images: String,
    val introduction: String,
    val isaudit: String,
    val isfreight: String,////0 包邮 1协商
    val ismarketable: String,
    val issale: String,
    val minprice: String,
    val name: String,
    val price: String,
    val promise: String,
    val promiseimage: String,
    val province: String,
    val reseq: Long,//0 不是推荐 1推荐
    val salenum: Int,
    val secaid: Int,
    val secname: String,
    val seq: Int,
    val skuList: List<SkuBean>?,
    val thcaid: Int,
    val thcname: String,
    val txaccid: String,
    val type: String,
    val updated: Long,
    val isspecially: String? = null,
    val isopen: String? = null,
    val wantnum: Int
) : Parcelable

@Parcelize
@Keep
data class SkuBean(
    val cpyid: String,
    val created: Long,
    val goodsnum: Int,
    val id: String,
    val ismarketable: String,
    val name: String,
    val price: Int,
    val salenum: Int,
    val spuid: String,
    val stock: String
) : Parcelable

//fun GoodsDetailsBean.GoodsItemBean():GoodsItemBean{
//   return GoodsItemBean()
//}


@Parcelize
@Keep
data class CusCategoryDatasBean(
    var counts: String?,
    val page: String,
    val pagesize: String,
    val pages: String,
    val items: List<CusCategoryBean>?,
) : Parcelable

@Parcelize
@Keep
data class CusCategoryBean(
    val id: String?,
    val name: String?,
    val spuids: List<String>?,
    val cpyid: String?,
) : Parcelable

@Parcelize
@Keep
data class ComsetBean(
    var isset: String?,
    val name: String?,
    val secaid: Int?,
    val fcaid: Int?,
) : Parcelable

@Parcelize
@Keep
data class BackdropsBeans(
    var backdrops: List<String>?,
) : Parcelable

